Data processors are classically defined as having a central processing unit, memory, and input/output devices. Recent advances in integrated circuit technology have allowed many of the classical computer functions to be integrated onto a single integrated circuit chip. These devices are known by a variety of terms such as microcontrollers, embedded controllers, microcomputers and the like. However, they share a common characteristic in that they have incorporated most classical computer functions on-chip. Because of their high level of integration, microcontrollers are ideal for use in products such as engine controllers, appliances, communications devices, and the like. In order to alleviate the need for external memory to store the operating program, microcontrollers commonly include non-volatile memory in the form of read only memory (ROM), programmable ROM (PROM), erasable programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM OR E.sup.2 PROM), or one-time programmable ROM (OTPROM).
Microcontrollers continue to become more complex, and are capable of supporting large amounts of onboard non-volatile memory. As a result of the increased complexity and memory sizes, the cost of developing application software for microcontrollers has become a major investment. Often the success or failure of a product can depend on the ability to prevent others from obtaining copies of a product's microcontroller code.
It is well known that code stored in a microcontroller's non-volatile memory can be copied by configuring the microcontroller such that it will power-up in an external mode of operation. In this mode, the microcontroller will operate from code stored in an external memory location. An unauthorized individual may obtain a copy of application software stored in internal memory by placing code in the external memory that will read the contents of the internal memory, and write those contents to an output port. A microcontroller which supports a secured mode of operation can be used to prevent this unauthorized access from occurring.
As discussed in copending patent application Ser. No. 08/323,558, entitled "Data Processor Having Operating Modes Selected by at Least One Mask Option Bit and Method Therefor", a microcontroller may operate in a security mode through the use of a non-volatile register location. A specific bit of this register is dedicated to being a security bit. When the security bit is set, the microcontroller is in a secured mode of operation. A user can write to this register bit, in order to set the microcontroller into security mode.
A prior art security mode circuit 100 is shown in the block diagram of FIG. 1. An address decode circuit 102 generates an address enable signal 116 when an internal memory location is being accessed. This signal is gated with a security enable signal 118, which is active when the security bit is set, to produce a bus enable signal 114. The bus enable signal is used to disable the drivers 108. Disabling the drivers prevents the contents of the main memory 106, where the code is stored, from being displayed external to the microcontroller. If the security bit 104 is enabled, and an access to the main memory 106 occurs, the bus drivers 108 will be disabled to prevent memory contents from being driven external to the microcontroller.
It is known that erroneous results may by obtained from an EPROM memory if the supply voltage is varied significantly. This would not present a security problem to a microcontroller's security mode if the voltage variation causing the security feature to fail also caused the on-chip memory to fail as well. However, a problem exists when registers and main memory locations consist of separate memory cells and sense-amps, and the supply voltage is varied. In such cases, it is possible for the register memory location to fail before the main memory, which contains the code, fails. When this happens, it is possible for the code to be copied in the manner previously described. Therefore, a need exists for an apparatus and method to prevent a register memory location containing a security bit from failing before the main memory location fails.